package com.example.excelimporter.model;

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;

@Schema(description = "Result of an Excel import operation")
public class ImportResult {
    @Schema(description = "Total number of records processed", example = "100")
    private int totalCount;
    
    @Schema(description = "Number of successfully imported records", example = "95")
    private int successCount;
    
    @Schema(description = "Number of records that failed to import", example = "5")
    private int errorCount;
    
    @Schema(description = "List of error records with details about import failures")
    private List<ErrorRecord> errorRecords;
    
    @Schema(description = "General error message if the entire import operation failed", example = "Invalid file format")
    private String errorMessage;

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getSuccessCount() {
        return successCount;
    }

    public void setSuccessCount(int successCount) {
        this.successCount = successCount;
    }

    public int getErrorCount() {
        return errorCount;
    }

    public void setErrorCount(int errorCount) {
        this.errorCount = errorCount;
    }

    public List<ErrorRecord> getErrorRecords() {
        return errorRecords;
    }

    public void setErrorRecords(List<ErrorRecord> errorRecords) {
        this.errorRecords = errorRecords;
    }

    public double getSuccessRate() {
        return totalCount > 0 ? (double) successCount / totalCount * 100 : 0;
    }

    public double getFailureRate() {
        return totalCount > 0 ? (double) errorCount / totalCount * 100 : 0;
    }
}
